package zhuyun.code

fun main(args:Array<String>){
    val target:Target = ObjectAdapter(Adaptee())
    target.request()
    val str = String()

}

interface Target{
    fun request()
}
open class Adaptee{
    fun specificRequest(){
        println("适配者中的业务代码被调用")
    }
}
//类适配器
class ClassAdapter:Adaptee(),Target{
    override fun request() {
        specificRequest()
    }

}
//对象适配器
class ObjectAdapter(val adaptee: Adaptee):Target{
    override fun request() {
        adaptee.specificRequest()
    }

}
